package com.example.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.*;

/**
 * 用户实体类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {

    @NotBlank(message = "{user.name.not.empty}")
    @Size(min = 2, max = 50, message = "{user.name.size}")
    private String name;

    @NotBlank(message = "{user.email.not.empty}")
    @Email(message = "{user.email.invalid}")
    private String email;

    @NotNull(message = "{user.age.positive}")
    @Min(value = 1, message = "{user.age.min}")
    @Max(value = 150, message = "{user.age.max}")
    private Integer age;

    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "{validation.pattern}")
    private String phone;
} 